<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #card{
            width: 500px;
            height: 350px;
        }
        .title{
            height:50px;
        }
        .title span{
            width: 100px;
            height: 50px;
            background-color:#ccc;
            display: inline-block;
            line-height: 50px; /* 设置行和当前元素的高度相等,就可以让文本内容上下居中 */
            text-align:center;
        }
        .content .list{
            width: 500px;
            height: 300px;
            background-color: yellow;
            display: none;
        }
        .content .active{
            display: block;
        }

        .title .current{
            background-color: yellow;
        }
    </style>
    <script src="js/vue.js"></script>
</head>
<body>

    <div id="card">
        <div class="title">
            <span @click="index=0" :class="index==0?'current':''">国内新闻</span>
            <span @click="index=1" :class="index==1?'current':''">国际新闻</span>
            <span @click="index=2" :class="index==2?'current':''">银河新闻</span>
        </div>
        <div class="content">
            <div class="list" :class="index==0?'active':''">国内新闻列表</div>
            <div class="list" :class="index==1?'active':''">国际新闻列表</div>
            <div class="list" :class="index==2?'active':''">银河新闻列表</div>
        </div>
    </div>
    <script>
        // 思路：
        // 当用户点击标题栏的按钮[span]时，显示对应索引下标的内容块[.list]
        // 代码实现：
        var card = new Vue({
            el:"#card",
            data:{
                index:0, // 当前显示的内容块
            },
        });
    </script>

</body>
</html>